Skip to content

feat: add TOML 1.1 support with multiline inline tables#5655

Draft
baszalmstra wants to merge 1 commit intomainfrom
claude/update-toml-multiline-tables-Mhrjf
Draft

feat: add TOML 1.1 support with multiline inline tables#5655
baszalmstra wants to merge 1 commit intomainfrom
claude/update-toml-multiline-tables-Mhrjf

Conversation

@baszalmstra
Copy link
Contributor

Description

Update TOML crates to support the TOML 1.1 specification, which introduces multiline inline tables and trailing commas. This improves readability of pixi.toml files by allowing users to write:

[dependencies]
python = {
    version = ">=3.12",
    channel = "conda-forge",
}

Crate updates (minimum versions for TOML 1.1):

  • toml-span: 0.6.0 → 0.7.0 (TOML 1.1 parsing support)
  • toml_edit: 0.23.0 → 0.25.0 (TOML 1.1 editing support)

Documentation updated to note TOML 1.1 support in the manifest reference.

How Has This Been Tested?

Added 6 new tests in pixi_manifest:

  • 3 manifest parsing tests — verify multiline inline tables with trailing commas parse successfully for dependencies, nested build backend config, and mixed formatting
  • 2 document editing tests (insta snapshots) — verify toml_edit preserves multiline inline table formatting when parsing and inserting values
  • 1 error span test (insta snapshot) — verifies diagnostics point to the exact value inside a multiline inline table:
      8 │         bad-pkg = {
      9 │             version = "!invalid!",
        ·                        ─────────
     10 │             channel = "conda-forge",
    

All 285 pixi_manifest tests pass. Full project builds cleanly (cargo check succeeds).

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude Code

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really excited for this. I'd like to play a bit more with it locally before we merge it

@Hofer-Julian
Copy link
Contributor

Hofer-Julian commented Mar 11, 2026

pixi add behaves a bit weird here:

[workspace]
authors = ["Julian Hofer <julianhofer@gnome.org>"]
channels = ["conda-forge"]
name = "toml-1.1"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[feature.test]
dependencies = {
    numpy = "*"
}

[environments]
test = ["test"]

Then run pixi add --feature test pydantic gives me this:

[feature.test]
dependencies = {
    numpy = "*"
, pydantic = ">=2.12.5,<3" }

I would have expected:

[feature.test]
dependencies = {
    numpy = "*",
    pydantic = ">=2.12.5,<3", 
}

baszalmstra pushed a commit that referenced this pull request Mar 11, 2026
Adds an explicit test reproducing the issue from PR #5655 comment
where inserting into a single-entry multiline inline table without a
trailing comma could produce malformatted output. The fix already
handles this case correctly.

https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
@baszalmstra baszalmstra marked this pull request as draft March 12, 2026 08:38
@baszalmstra
Copy link
Contributor Author

I converted to draft because I think this could be integrated better in more places. Im working on that now.

@baszalmstra baszalmstra force-pushed the claude/update-toml-multiline-tables-Mhrjf branch 5 times, most recently from 665528a to 3b69df2 Compare March 12, 2026 10:43
Bump toml_edit to 0.25 / toml to 0.9.10 which support TOML 1.1 multiline
inline tables. Add insert_into_inline_table_with_format to preserve
multiline formatting, indentation style, and trailing comma conventions
when inserting new entries.

Includes comprehensive tests: direct unit tests for the formatting
function (trailing commas, sequential insertions, empty tables, tab
indentation, single-line fallback, existing key updates, non-dependency
tables), integration tests through TomlDocument, and consolidated
parse-only tests for upstream TOML 1.1 support. All tests use inline
insta snapshots.

https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
@baszalmstra baszalmstra force-pushed the claude/update-toml-multiline-tables-Mhrjf branch from 3b69df2 to 7a1d409 Compare March 12, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants